package com.cn.web.controller.bc;

import com.alibaba.fastjson2.JSONObject;

import com.cn.bean.pojo.bc.Button;
import com.cn.service.server.bc.ButtonServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
public class ButtonController {
    private final ButtonServer buttonServer;

    @Autowired
    public ButtonController(ButtonServer buttonServer) {
        this.buttonServer = buttonServer;

    }

    @RequestMapping("/select/Permissions/Button")
    @ResponseBody
    public List<Button> selectMenu(@RequestBody JSONObject jsonObject) {
        String userName = jsonObject.getString("userName");
        Integer menuId = jsonObject.getInteger("menuId");
        List<Button> buttons = buttonServer.selectButtonList(userName, menuId);
        return buttons;
    }
}
